package cn.edu.xmu.orderpayment.order.microservice;

import cn.edu.xmu.oomall.core.util.ReturnNo;
import cn.edu.xmu.oomall.core.util.ReturnObject;
import cn.edu.xmu.orderpayment.order.microservice.vo.OnSaleRetVo;
import cn.edu.xmu.orderpayment.order.microservice.vo.OnsaleVo;
import cn.edu.xmu.orderpayment.order.microservice.vo.ProductRetVo;
import cn.edu.xmu.orderpayment.order.microservice.vo.QuantityVo;
import cn.edu.xmu.privilegegateway.annotation.util.InternalReturnObject;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author Li Yixuan 22920192204232
 * @create: 2021/12/18
 */
@FeignClient(value = "goods-service")
public interface GoodsService {

    @GetMapping("internal/onsales/{id}")
    InternalReturnObject<OnSaleRetVo> selectFullOnsale(@PathVariable Long id);

    //可能有错
    @PutMapping("internal/shops/{did}/onsales/{id}/incr")
    InternalReturnObject increaseOnSale(@PathVariable Long did, @PathVariable Long id,@Validated @RequestBody QuantityVo vo);

    //可能有错
    @PutMapping("internal/shops/{did}/onsales/{id}/decr")
    InternalReturnObject decreaseOnSale(@PathVariable Long did, @PathVariable Long id, @Validated @RequestBody QuantityVo vo,
                                        @RequestParam Long loginUserId, @RequestParam String loginUserName);

    //完成
    @GetMapping("internal/products/{id}/detail")
    InternalReturnObject<ProductRetVo> getProductById(@PathVariable Long id);

    @PutMapping("internal/onsales/{id}/stock")
    ReturnObject updateOnsaleQuantity(@PathVariable Long id, @RequestBody QuantityVo vo);
}
